﻿@{
    Layout = null;
}

<!DOCTYPE HTML>
<html>
<head>
    <script id="allmobilize" charset="utf-8" src="~/style/js/allmobilize.min.js"></script>
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="alternate" media="handheld" />
    <!-- end 云适配 -->
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>登录-1024网-最专业的互联网招聘平台</title>
    <meta property="qc:admins" content="23635710066417756375" />
    <meta content="1024网是3W旗下的互联网领域垂直招聘网站,互联网职业机会尽在1024网" name="description">
    <meta content="1024,1024网,1024招聘,拉钩, 拉钩网 ,互联网招聘,1024互联网招聘, 移动互联网招聘, 垂直互联网招聘, 微信招聘, 微博招聘, 1024官网, 1024百科,跳槽, 高薪职位, 互联网圈子, IT招聘, 职场招聘, 猎头招聘,O2O招聘, LBS招聘, 社交招聘, 校园招聘, 校招,社会招聘,社招" name="keywords">

    <meta name="baidu-site-verification" content="QIQ6KC1oZ6" />

    <!-- <div class="web_root"  style="display:none">h</div> -->
    <link href="~/layui/css/layui.mobile.css" rel="stylesheet" />
    <script src="~/layui/layui.all.js"></script>
    <script src="~/layui/layui.js"></script>
    <link href="~/layui/css/layui.css" rel="stylesheet" />
    <link rel="Shortcut Icon" href="~/h/images/favicon.ico">
    <link href="~/style/css/style.css" rel="stylesheet" />
    <link href="~/layui/css/layui.css" rel="stylesheet" />
    <script src="~/style/js/jquery.1.10.1.min.js"></script>
    <script type="text/javascript" src="~/style/js/jquery.lib.min.js"></script>
    <script type="text/javascript" src="~/style/js/core.min.js"></script>
    <script type="text/javascript">
        var youdao_conv_id = 271546;
    </script>
    <script type="text/javascript" src="~/style/js/conv.js"></script>
    <script src="~/layui/layui.js"></script>
</head>

<body id="login_bg">
    <div class="login_wrapper">
        <div class="login_header">
            <a href="/Home/Index"><img src="~/style/images/logo_white.png" width="285" height="62" alt="1024招聘" /></a>
            <div id="cloud_s"><img src="~/style/images/cloud_s.png" width="81" height="52" alt="cloud" /></div>
            <div id="cloud_m"><img src="~/style/images/cloud_m.png" width="136" height="95" alt="cloud" /></div>
        </div>

        <input type="hidden" id="resubmitToken" value="" />
        <div class="login_box">
            <form id="loginForm">
                <style type="text/css">
                    #userLogin, #phoneLogin, #companyLogin {
                        display: inline-block;
                        padding: 0px 10px 10px 10px;
                        margin: 0px 20px 20px 0px;
                        cursor: pointer;
                    }

                    .buttom {
                        border-bottom: 3px solid rgb(1,152,117);
                    }
                </style>
                <div>
                    <div id="userLogin" class="buttom">用户登录</div>
                    <div id="phoneLogin">手机登录</div>
                    <div id="companyLogin">公司登录</div>
                </div>
                <div id="userLogin_box">
                    <input type="text" id="email" name="email" value="" tabindex="1" placeholder="请输入登录邮箱地址" />
                    <input type="password" id="password" name="password" tabindex="2" placeholder="请输入密码" />
                    @*<label class="fl" for="remember"><input type="checkbox" id="remember" value="" name="autoLogin" /> 记住我</label>*@
                    <a href="reset.html" class="fr" target="_blank">忘记密码？</a>
                </div>
                <div id="phoneLogin_box" style="display:none">
                    <input type="text" id="phone" name="phone" value="" tabindex="1" placeholder="请输入手机号" />
                    <span class="error" style="display:none;" id="beError"></span>
                    <span>
                        <input type="text" id="code" name="code" tabindex="2" placeholder="请输入验证码" style="width:150px; margin-right:20px;" />
                        <input type="button" name="codebtn" id="codebtn" value="点击发送验证码" style=" padding : 10px 3px; background-color: rgb(23, 155, 105); border:1px solid rgb(23, 155, 105); color:white">
                    </span>
                </div>
                @*手机登录验证码*@
                <script type="text/javascript">
                    ///验证验证码是否正确
                    function CoreIsTrue() {
                        var flag = false;
                        if ($("#code").val().length != 6) {//不是6位不判断,提高效率
                            return false;
                        }
                        var data = {};
                        data.Phone = $("#phone").val();
                        data.CodeNum = $("#code").val();
                        $.ajax({
                            async: false,
                            type: "post",
                            url: "/Verificationcode/ValidateCode",
                            data: data,
                            success: function (result) {
                                if (result.success) {
                                    flag = true;
                                } else {
                                    flag = false;
                                }
                            }
                        })
                        return flag;
                    }

                    //自定义表单验证
                    jQuery.validator.addMethod("CoreIsTrue", function (value, element) {
                        var length = value.length;
                        var isTrue = CoreIsTrue();
                        return this.optional(element) || isTrue;
                    }, "请输入正确的验证码");
                    function sendyzm(obj) {
                        layui.use("layer", function () {
                            var phone = $("#phone").val();
                            $.ajax({
                                url: "/Verificationcode/SendCode?tel=" + phone,
                                data: { Phone: phone },
                                dataType: "json",
                                type: "post",
                                async: false,
                                cache: false,
                                success: function (res) {
                                    if (res.success) {
                                        layui.layer.msg("验证码发送成功");
                                    } else {
                                        layui.layer.msg("验证码发送失败");
                                    }
                                },
                                error: function () {
                                    layui.layer.msg("验证码发送失败");
                                }
                            })
                        });
                        setTime(obj);//开始倒计时
                    }

                    $("#phone").focus(function () {
                        $('#beError').hide();
                    })

                    $("#codebtn").click(function () {
                        if ($("input[name=phone]").val() == "") {
                            $('#beError').text("请先填写手机号码").show();
                        } else {
                            sendyzm($("#codebtn"));
                        }
                    })
                    //60s倒计时实现逻辑
                    var countdown = 60;
                    function setTime(obj) {
                        if (countdown == 0) {
                            obj.prop('disabled', false);
                            obj.val("点击获取验证码");
                            obj.css("background-color", "rgb(23, 155, 105)");
                            countdown = 60;//60秒过后button上的文字初始化,计时器初始化;
                            return;
                        } else {
                            obj.prop('disabled', true);
                            obj.val("(" + countdown + "s)后重新发送");
                            obj.css("background-color", "#999");
                            countdown--;
                        }
                        setTimeout(function () { setTime(obj) }, 1000) //每1000毫秒执行一次
                    }
                    //校验手机号是否合法
                    function isPhoneNum() {
                        var reg = /^[1][3,4,5,7,8][0-9]{9}$/;
                        var phonenum = $("input[name=phone]").val();
                        if (!reg.test(phonenum)) {
                            return false;
                        } else {
                            return true;
                        }
                    }
                </script>

                @*切换登录方式*@
                <script type="text/javascript">
                    $("#phoneLogin").click(function () {
                        $("#phoneLogin_box").css("display", "inline-block");
                        $("#userLogin_box").css("display", "none");
                        $(this).addClass("buttom");
                        $(this).siblings().removeClass("buttom");
                    })
                    $("#userLogin,#companyLogin").click(function () {
                        $("#phoneLogin_box").css("display", "none");
                        $("#userLogin_box").css("display", "inline-block");
                        $(this).addClass("buttom");
                        $(this).siblings().removeClass("buttom");
                    })
                </script>
                <!--<input type="submit" id="submitLogin" value="登 &nbsp; &nbsp; 录" />-->
                <input style="color:#fff;" class="submitLogin" type="submit" title="登 &nbsp; &nbsp; 录" value="登录" />


                <input type="hidden" id="callback" name="callback" value="" />
                <input type="hidden" id="authType" name="authType" value="" />
                <input type="hidden" id="signature" name="signature" value="" />
                <input type="hidden" id="timestamp" name="timestamp" value="" />
            </form>
            <div class="login_right">
                <div>还没有1024帐号？</div>
                <a href="Register" class="registor_now">立即注册</a>
                <div class="login_others">使用以下帐号直接登录:</div>
                <a href="h/ologin/auth/sina.html" target="_blank" class="icon_wb" title="使用新浪微博帐号登录"></a>
                <a href="/QQuser/Login" class="icon_qq" target="_blank" title="使用腾讯QQ帐号登录"></a>
            </div>
        </div>
        <div class="login_box_btm"></div>
    </div>


    <script type="text/javascript">
        $(function () {
            //验证表单
            $("#loginForm").validate({
                //debug: true,//只验证不提交表单
                /* onkeyup: false,
            focusCleanup:true, */
                //验证规则,通过name验证
                rules: {
                    email: {
                        required: true,
                        email: true
                    },
                    password: {
                        required: true
                    },
                    phone: {
                        required: true,
                    },
                    code: {
                        required: true,
                        CoreIsTrue: true
                    }
                },
                //错误消息提示,通过id显示
                messages: {
                    email: {
                        required: "请输入登录邮箱地址",
                        email: "请输入有效的邮箱地址，如：vivi@lagou.com"
                    },
                    password: {
                        required: "请输入密码"
                    },
                    phone: {
                        required: "请输入手机号码"
                    },
                    code: {
                        required: "请输入验证码",
                        CoreIsTrue:"请输入正确的验证码"
                    }
                },
                ignore: ":hidden",//忽略隐藏元素的验证
                //错误消息出现的位置,默认为input元素后,为了防验证码崩,给他设为父级显示
                errorPlacement: function (error, element) {
                    if (element.attr("name") == "code") {
                        error.appendTo(element.parent());
                    } else {
                        error.insertAfter(element);
                    }
                },
                submitHandler: function (form) {
                    var remember = $('#remember').prop("checked");
                    var Email = $("#email").val();
                    var password = $("#password").val();
                    var phone = $("#phone").val();
                    var code = $("#code").val();
                    var datas = {};
                    datas.Email = Email;
                    datas.UserPwd = password;
                    datas.Phone = phone;
                    datas.CodeNum = code;
                    // $(form).find(":submit").attr("disabled", true);
                    //手机登录
                    if ($(".buttom").text() == "手机登录") {
                        $.ajax({
                            type: "post",
                            url: "/Login/QueryVerificationCode",
                            data: datas,
                        }).done(function (result) {
                            if (result.success) {
                                if (document.referrer != null &&
                                    document.referrer.indexOf("/AccountInfo/") == -1 && document.referrer.indexOf("/Login/") == -1) {
                                    location.href = document.referrer;
                                } else {
                                    window.location.href = "/Home/Index";
                                }
                            } else {
                                layer.msg("手机号或验证码不正确！", { icon: 2 });
                            }
                        });
                    } else if ($(".buttom").text() == "公司登录") {
                        $.ajax({
                            type: "post",
                            url: "/Login/GetLogin?type=false",
                            data: datas,
                        }).done(function (result) {
                            if (result.success) {
                                if (document.referrer != null
                                    && document.referrer.indexOf("/AccountInfo/") == -1 && document.referrer.indexOf("/Login/") == -1) {
                                    location.href = document.referrer;
                                } else {
                                    window.location.href = "/Home/Index";
                                }
                            } else {
                                layer.msg("邮箱或密码错误！", { icon: 2 });
                            }
                        });
                    } else {
                        $.ajax({
                            type: "post",
                            url: "/Login/GetLogin?type=true",
                            data: datas,
                        }).done(function (result) {
                            if (result.success) {
                                if (document.referrer != null &&
                                    document.referrer.indexOf("/AccountInfo/") == -1 && document.referrer.indexOf("/Login/") == -1) {
                                    location.href = document.referrer;
                                } else {
                                    window.location.href = "/Home/Index";
                                }
                            } else {
                                layer.msg("邮箱或密码错误！", { icon: 2 });
                            }
                        });
                    }
                }
            });
        })
    </script>
</body>
</html>